using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace MyWords
{
    public class Utility
    {

        public static void PlayAudio(Word word)
        {
            StopAudio();



            if (word.Head != "")
            {
                if (word.Audio == AudioFormat.Unknown) DB.LoadAudio(word);
                if (word.Audio == AudioFormat.None) return;
                if (word.Audio == AudioFormat.Original)
                {
                    MemoryStream ms = new MemoryStream();
                    ms.Write(word.AudioBytes, 0, word.AudioBytes.Length);
                    cswavrec.AudioPlayer.StartPlay(ms, true);
                }
            }
        }

        public static void StopAudio()
        {
            cswavrec.AudioPlayer.StopPlay();
        }
    }
}
